from ply import lex

reserved = {
'check' : 'CHECK'
}

tokens = (
	"OPERATOR_SUB",
	"PLUS",
	"ENTANGLE",
	"NUMBER",
	"VARIABLE_NAME",
	"DEBUG_PRINT",
) + tuple(reserved.values())

t_DEBUG_PRINT = (
	r"_(print|display)"
)

t_OPERATOR_SUB = (
	r"=")

t_PLUS = (
	r"\+")

t_ENTANGLE = (
	r"&")

def t_VARIABLE_NAME(t):
	r"[a-zA-Z][a-zA-Z0-9_]*"
	t.type = reserved.get(t.value, "VARIABLE_NAME")
	return t

def t_NUMBER(t):
	r"\d+"
	t.value = int(t.value)
	return t

def t_error(t):
    raise TypeError("Unknown text '%s'" % (t.value,))

t_ignore = " "

lex.lex()
